﻿using Puppy.Domain.Repositories;
using System;
using System.Collections.Generic;

namespace Puppy.ActorDb
{
    public class ActorDbRepositoryRegistrar : RepositoryRegistrarBase<ActorDbContextRegistrationOptions>
    {
        public ActorDbRepositoryRegistrar(ActorDbContextRegistrationOptions options)
            : base(options)
        {
        }

        protected override IEnumerable<Type> GetEntityTypes(Type dbContextType)
        {
            return ActorDbContextHelper.GetEntityTypes(dbContextType);
        }

        protected override Type GetRepositoryType(Type dbContextType, Type entityType)
        {
            return typeof(ActorDbRepository<,>).MakeGenericType(dbContextType, entityType);
        }

        protected override Type GetRepositoryType(Type dbContextType, Type entityType, Type primaryKeyType)
        {
            return typeof(ActorDbRepository<,,>).MakeGenericType(dbContextType, entityType, primaryKeyType);
        }
    }
}
